﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Include/Admin.master" AutoEventWireup="true"
    CodeFile="Manage.aspx.cs" Inherits="Admin_AdminUser_Manage" %>

<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="ajaxToolkit" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="Server">
    <link href="../../Scripts/jquery-easyui-1.3.1/themes/default/easyui.css" rel="stylesheet"
        type="text/css" />
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="Server">
    <ajaxToolkit:ToolkitScriptManager runat="Server" EnableScriptGlobalization="true"
        EnableScriptLocalization="true" ID="ScriptManager1" />
    <table cellspacing="0" cellpadding="0" style="width: 100%; height: 30px; padding-bottom: 5px;
        border: 1px; border-color: #66CCFF;">
        <tr style="background-image: url('/images/管理员页面/title_bg1.jpg'); background-repeat: repeat-x;">
            <td style="font-weight: bold; font-size: large; font-family: 仿宋;">
                <strong>【管理员管理】</strong>
            </td>
        </tr>
    </table>
    <table class="editTable" cellpadding="0px" cellspacing="1px">
        <tr>
            <th>
                管理员角色
            </th>
            <td>
                <asp:DropDownList ID="drpAdminRole" runat="server">
                </asp:DropDownList>
            </td>
            <th>
                登入时间
            </th>
            <td>
                从<asp:TextBox ID="txtTimeFrom" CssClass="easyui-datebox" runat="server"></asp:TextBox>到<asp:TextBox ID="txtTimeTo" CssClass="easyui-datebox"
                    runat="server"></asp:TextBox>
            </td>
            <th>
                关键字
            </th>
            <td>
                <asp:TextBox ID="txtKey" runat="server"></asp:TextBox>
            </td>
            <td>
                <asp:Button ID="btnSearch" runat="server" Text="搜索" OnClick="btnSearch_Click" />
            </td>
        </tr>
    </table>
    <br />
    <asp:ListView ID="lvAdminUser" runat="server" DataKeyNames="ID" OnItemCanceling="lvAdminUser_ItemCanceling"
        OnItemDeleting="lvAdminUser_ItemDeleting" OnItemEditing="lvAdminUser_ItemEditing"
        OnItemUpdating="lvAdminUser_ItemUpdating">
        <LayoutTemplate>
            <table class="editTable" width="100%" cellspacing="1">
                <tr>
                    <th>
                        角色名称
                    </th>
                    <th>
                        账户名称
                    </th>
                    <th>
                        密码
                    </th>
                    <th>
                        最近登入时间
                    </th>
                    <th>
                        操作
                    </th>
                </tr>
                <asp:PlaceHolder ID="itemPlaceholder" runat="server"></asp:PlaceHolder>
            </table>
        </LayoutTemplate>
        <ItemTemplate>
            <tr>
                <td>
                    <%#GetAdiminRolNameByRoleID(Eval("RoleID"))%>
                </td>
                <td>
                    <%# Eval("UserName")%>
                </td>
                <td>
                    <%# Eval("Password")%>
                </td>
                <td>
                    <%# Eval("LoginTime")%>
                </td>
                <td>
                    <asp:LinkButton ID="lbtnEdit" runat="server" CommandName="Edit" Text="修改"></asp:LinkButton>&nbsp;&nbsp;
                    <asp:LinkButton ID="lbtnDelete" runat="server" Text="删除" OnClientClick="return confirm('您确定要删除该项吗?');"
                        CommandName="Delete"></asp:LinkButton>
                </td>
            </tr>
        </ItemTemplate>
        <EditItemTemplate>
            <tr>
                <td>
                    <asp:DropDownList ID="drpEditRole" runat="server">
                    </asp:DropDownList>
                </td>
                <td>
                    <asp:TextBox ID="txtEdiName" runat="server" Text='<%#Eval("UserName")%>'></asp:TextBox>
                    <asp:RequiredFieldValidator ID="rfvEditName" runat="server" Display="Static" ErrorMessage="请输入用户名称"
                        ControlToValidate="txtEdiName" ValidationGroup="Update"></asp:RequiredFieldValidator>
                </td>
                <td>
                    <asp:TextBox ID="txtEditMiMa" runat="server" Text='<%#Eval("Password")%>'></asp:TextBox>
                    <asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" Display="Static"
                        ErrorMessage="请输入密码" ControlToValidate="txtEditMiMa" ValidationGroup="Update"></asp:RequiredFieldValidator>
                </td>
                <td>
                    <%# Eval("LoginTime")%>
                </td>
                <td style="width: 130px">
                    <asp:LinkButton ID="lbtnCancel" runat="server" Text="取消" CommandName="Cancel"></asp:LinkButton>&nbsp;&nbsp;<asp:LinkButton
                        ID="lbtnUpdate" runat="server" Text="更新" CommandName="Update" ValidationGroup="Update"></asp:LinkButton>
                </td>
            </tr>
        </EditItemTemplate>
        <EmptyDataTemplate>
            没有数据<br />
            <br />
        </EmptyDataTemplate>
    </asp:ListView>
    <br />
    <br />
    <asp:HyperLink ID="lnkAdd" runat="server" Text="添加管理员" ForeColor="Blue"></asp:HyperLink>
    <asp:Panel ID="pnlAdd" runat="server" CssClass="addPnl">
        <h2>
            添加管理员
        </h2>
        <p>
            请完成下面的内容:
        </p>
        <table cellspacing="1">
            <tr>
                <th>
                    角色
                </th>
                <td>
                    <asp:DropDownList ID="drpAddAdminRole" runat="server">
                    </asp:DropDownList>
                </td>
            </tr>
            <tr>
                <th>
                    <span class="red">*</span>用户名称
                </th>
                <td>
                    <asp:TextBox ID="txtAddName" runat="server"></asp:TextBox>
                    <asp:RequiredFieldValidator ID="rfvAddName" runat="server" Display="Static" ErrorMessage="请输入用户名"
                        ControlToValidate="txtAddName" ValidationGroup="ClientAddGroup"></asp:RequiredFieldValidator>
                </td>
            </tr>
            <tr>
                <th>
                    <span class="red">*</span>用户密码
                </th>
                <td>
                    <asp:TextBox ID="txtAddPassWord" runat="server"></asp:TextBox>
                    <asp:RequiredFieldValidator ID="RequiredFieldValidator3" runat="server" Display="Static"
                        ErrorMessage="请输入用户密码" ControlToValidate="txtAddPassWord" ValidationGroup="ClientAddGroup"></asp:RequiredFieldValidator>
                </td>
            </tr>
            <tr>
                <td colspan="2" align="center">
                    <asp:Button ID="btnAdd" runat="server" ValidationGroup="ClientAddGroup" Text="添加"
                        OnClick="btnAdd_Click" />
                </td>
            </tr>
        </table>
    </asp:Panel>
    <ajaxToolkit:PopupControlExtender ID="PopUpExtender" runat="server" TargetControlID="lnkAdd"
        PopupControlID="pnlAdd" Position="Right">
    </ajaxToolkit:PopupControlExtender>
    <script src="../../Scripts/jquery-easyui-1.3.1/jquery.easyui.min.js" type="text/javascript"></script>
</asp:Content>
